﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HidesaburoDotNET.Core.Detecctors
{
    public class SyoususiDetector : YakuDetector
    {
        public override Yaku CheckYaku(AgariTehai agariTehai)
        {
            {
                int[] n = new int[4];
                for (int i = 0; i < 4; i++)
                {
                    n[i] = 0;
                }
                foreach (Hai h in agariTehai.Hai)
                {
                    if (h.Type == HaiType.Jihai)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            if (h.Number == i + 1)
                            {
                                n[i]++;
                            }
                        }
                    }
                }
                int j = 0;
                for (int i = 0; i < 4; i++)
                {
                    if (n[i] < 2)
                    {
                        return new Yaku();
                    }
                    else if (n[i] == 2)
                    {
                        j++;
                    }
                }
                if (j == 1)
                {
                    return new Yaku(13, "ショースーシー");
                }
                return new Yaku();
            }
        }
    }
}
